﻿@model GrainManage.Server.Models.ControllerModel
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>API查询</title>
    <link rel="stylesheet" href="~/Content/Css/api.css" type="text/css" />
</head>
<body>

    @*显示Controller列表*@
    <div class="controllerCatalog">
        @{
            for (int i = 0; i < Model.Controllers.Count; i++)
            {
            <a href="@string.Format("/ApiDetail?controllerName={0}&&type={1}", Model.Controllers[i], "")">@Model.Controllers[i]</a>
            }
        }
    </div>

    @*显示Controller名称*@
    <p class="controllerName">
        @Model.Name
    </p>

    @*显示Action列表*@
    <ol class="actionCatalog">
        @foreach (var action in Model.Methods)
        {
            <li>
                <a href="#@action.AnchorName">@action.Name</a>
            </li>
        }
    </ol>

    @*显示Action各项参数*@
    <div>
        @for (int i = 0; i < Model.Methods.Count; i++)
        {
            var action = Model.Methods[i];
            string mainUrl = string.Empty;
            <p id="@action.AnchorName" class="actionName">
                @string.Format("{0}. {1}", i + 1, action.Name)
            </p>
            if (Model.IsGet)
            {
                mainUrl = string.Format("{0}/{1}/{2}?type={3}", Model.Domain, Model.Name, action.Name, Model.IsSchema ? "schema" : "api");
            <a href="@mainUrl" class="url">@mainUrl</a>
            }
            else
            {
                mainUrl = string.Format("{0}/{1}/{2}", Model.Domain, Model.Name, action.Name);
            <p class="url">@mainUrl</p>
            }
         
            <p class="ioType">Input Type:</p>
            <p class="parameterString">@action.ParameterString</p>
            <pre>@action.InputString</pre>
            <p class="ioType">Output Type:</p>
            <p class="parameterString">@action.ReturnType</p>
            <pre>@action.OutputString</pre>
        }
    </div>
</body>
</html>
